package com.chujian.sys.entity;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chujian.framework.core.IId;
import com.chujian.framework.core.IIdName;
import com.chujian.framework.core.base.BaseTreeEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;


/**
 * 部门表
 *
 * @author yj
 * @since 2021-08-06
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_dept")
@KeySequence("sys_dept_seq")
public class SysDept extends BaseTreeEntity<SysDept> implements IId, IIdName {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "部门ID ")
    @TableId("dept_id")
    private Long deptId;

    @ApiModelProperty(value = "部门名称 ")
    @TableField("dept_name")
    private String deptName;

    @ApiModelProperty(value = "账套id")
    @TableField("ac_id")
    private Long acId;

    @ApiModelProperty(value = "标签")
    @TableField("tag")
    private String tag;

    @ApiModelProperty(value = "状态")
    @TableField("status")
    private Boolean status;

    @ApiModelProperty(value = "负责人")
    @TableField("manager_id")
    private Long managerId;

    @ApiModelProperty(value = "拼音")
    @TableField("pin_yin")
    private String pinYin;

    @ApiModelProperty(value = "来源id")
    @TableField("source_id")
    private String sourceId;

    @ApiModelProperty(value = "来源系统")
    @TableField("source_system")
    private String sourceSystem;

    // ++++++ 系统拓展 +++++++
    @TableField(exist = false)
    private Map<String, String> query = new HashMap<>();

    @Override
    public Long getId() {
        return this.deptId;
    }

    @Override
    public void setId(Serializable id) {
        if (null != id) {
            this.deptId = Long.parseLong("" + id);
        }
    }

    @Override
    public String getName() {
        return this.deptName;
    }

    // ++++++ 业务拓展 +++++++

    @TableField(exist = false)
    private String manager;

}
